﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentNHibernate.Mapping;
using Konekcija.Core.Reporting.Dto.Application.Meta;

namespace Konekcija.Core.Reporting.Mappings.Meta
{
    public class ItemLevelMap : ClassMap<ItemLevel>
    {
        public ItemLevelMap()
        {
            Schema("meta");
            Table("ItemLevels");

            Id(x => x.Id).GeneratedBy.GuidComb().Not.Nullable();
            Map(x => x.LevelName).Nullable();
            Map(x => x.DateCreated).Nullable();

            HasManyToMany(x => x.Items)
                .LazyLoad()
                .Inverse()
                .AsBag()
                .Cascade.None()
                .ParentKeyColumn("LevelId")
                .ChildKeyColumn("ItemId")
                .Table("content.ItemsToLevels");
        }
    }
}
